<script setup>
import { ref, computed } from 'vue'
import { useAirStore } from '@/stores'
const airStore = useAirStore()
console.log(11111111111, airStore.hangxianList)
const routeLengthHx = computed(() => {
  return airStore.hangxianList?.reduce((total, item) => total + Number(item.routeLength), 0)
})
</script>
<template>
  <div class="card">
    <CommonTitle title="航线统计" />
    <div class="top">
      <p>
        <span class="num"
          ><text><NumberAnimate :count="13" /></text
        ></span>
        <span>航线数量<i>/条</i></span>
      </p>
      <p>
        <span class="fly-area"
          ><text><NumberAnimate :count="routeLengthHx / 1000" :decimalPlaces="2" /></text
        ></span>
        <span>航线长度<i>/km</i></span>
      </p>
    </div>
  </div>
</template>

<style lang="scss" scoped>
.card {
  padding: 10px 0 10px 10px;
  .top {
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    justify-content: space-around;
    background: url('@img/management/fly-info-bg.png');
    background-size: 100% 100%;
    p {
      display: flex;
      flex-direction: column;
      align-items: center;
      .num {
        width: 120px;
        height: 42px;
        text-align: center;
        line-height: 42px;
        background: url('@img/management/fly-num-bg.png');
        background-size: 100% 100%;
        text {
          background: linear-gradient(to bottom, #ffffff 0%, #00d5ff 100%);
          -webkit-background-clip: text; /* 让背景裁剪为文本形状 */
          // -webkit-text-fill-color: transparent; /* 使文本填充为透明 */
        }
        font-family: DINAlternate;
        font-weight: bold;
        font-size: 28px;
      }
      .fly-type {
        font-family: PingFangSCSemibold, PingFangSCSemibold;
        font-weight: normal;
        font-size: 16px;
        color: #ffffff;
        line-height: 42px;
        font-style: normal;
      }
      &:last-child {
        .fly-area {
          width: 120px;
          height: 42px;
          text-align: center;
          line-height: 40px;
          text {
            background: linear-gradient(to bottom, #ffffff 0%, #f8ee71 100%);
            -webkit-background-clip: text; /* 让背景裁剪为文本形状 */
            // -webkit-text-fill-color: transparent; /* 使文本填充为透明 */
          }
          background: url('@img/management/fly-area.png');
          background-size: 100% 100%;
          font-family: DINAlternate;
          font-size: 28px;
          line-height: 42px;
        }
      }
      i {
        font-weight: normal;
        font-style: normal;
        color: #2f9cff;
        margin-left: 5px;
        font-size: 16px;
      }
    }
  }
}
</style>
